Skip to content

.NET: Update AGUI service to support session storage#5193

Open
westey-m wants to merge 4 commits intomicrosoft:mainfrom
westey-m:agui-sessionstore-support
Open

.NET: Update AGUI service to support session storage#5193
westey-m wants to merge 4 commits intomicrosoft:mainfrom
westey-m:agui-sessionstore-support

Conversation

@westey-m
Copy link
Copy Markdown
Contributor

@westey-m westey-m commented Apr 9, 2026

Motivation and Context

AGUI wasn't supporting session store as defined in the core hosting package.

Description

  • Updating the AGUI.AspNet package to support SessionStore from the core hosting package
  • Updating sample to show how to use it correctly with an InMemorySessionStore

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings April 9, 2026 17:30
@moonbox3 moonbox3 added the .NET label Apr 9, 2026
@github-actions github-actions bot changed the title Update AGUI service to support session storage .NET: Update AGUI service to support session storage Apr 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the .NET AGUI ASP.NET Core hosting endpoint to integrate with the core hosting AgentSessionStore abstraction, enabling session persistence across requests (keyed by AG-UI thread ID). It also adds/updates tests and a sample to demonstrate the DI + in-memory session store setup.

Changes:

  • Add MapAGUI overloads that resolve a named agent from DI (via IHostedAgentBuilder or agentName).
  • Wrap agent execution with AIHostAgent and persist/restore sessions using a keyed AgentSessionStore (fallback to noop when not registered).
  • Add unit/integration tests and update the end-to-end sample to use WithInMemorySessionStore.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/AGUIEndpointRouteBuilderExtensions.cs Adds DI-based MapAGUI overloads and session persistence logic using AIHostAgent + AgentSessionStore.
dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.csproj Adds reference to the core hosting project to access session store abstractions.
dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs Adds unit tests for new overloads and session store/noop fallback behavior.
dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SessionPersistenceTests.cs Adds integration tests validating multi-turn session persistence via in-memory session store.
dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj Adds hosting project reference needed for WithInMemorySessionStore() usage in tests.
dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs Updates sample to register a named agent in DI and enable in-memory session persistence.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants